#include "Control_Visible.h"

#include "Control_Menu.h"
#include "WindowComponent.h"

#include "RendererComponent.h"

using namespace gui;

Control_Visible::Control_Visible(ColorRGBA<unsigned char> NewBackColor, Vec<2, float> NewPos, Vec<2, float> NewSize, Control_Menu* NewParentMenu, Host& NewParentHost) :
Control_Body(NewPos, NewSize, NewParentMenu, NewParentHost),
BackColor(NewBackColor)/*,
ParentMenuPos(nullptr),
ParentMenuLayer(nullptr)
{
if (NewParentMenu != nullptr)
{
ParentMenuLayer = &NewParentMenu->Layer;
ParentMenuPos = &NewParentMenu->Pos;
}
}*/
{}
Control_Visible::~Control_Visible()
{
}

void Control_Visible::UpdateVerticesFix(RendererComponent& Renderer)
{
	Renderer.GuiFixQuadColoredVertices[Renderer.GuiFixQuadColoredVertexCount++] = VertexPos3Col(
	ParentMenuPos->X + (Pos.X),
	-ParentMenuPos->Y + (-Pos.Y),
	*ParentMenuLayer,
	BackColor.R, BackColor.G, BackColor.B, BackColor.A);
	
	Renderer.GuiFixQuadColoredVertices[Renderer.GuiFixQuadColoredVertexCount++] = VertexPos3Col(
	ParentMenuPos->X + (Pos.X),
	-ParentMenuPos->Y + (-Pos.Y - Size.Y),
	*ParentMenuLayer,
	BackColor.R, BackColor.G, BackColor.B, BackColor.A);

	Renderer.GuiFixQuadColoredVertices[Renderer.GuiFixQuadColoredVertexCount++] = VertexPos3Col(
	ParentMenuPos->X + (Pos.X + Size.X),
	-ParentMenuPos->Y + (-Pos.Y - Size.Y),
	*ParentMenuLayer,
	BackColor.R, BackColor.G, BackColor.B, BackColor.A);

	Renderer.GuiFixQuadColoredVertices[Renderer.GuiFixQuadColoredVertexCount++] = VertexPos3Col(
	ParentMenuPos->X + (Pos.X + Size.X),
	-ParentMenuPos->Y + (-Pos.Y),	
	*ParentMenuLayer,
	BackColor.R, BackColor.G, BackColor.B, BackColor.A);
}
